package com.example.springcloud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.springcloud.entity.Dept;
import com.example.springcloud.service.DeptClientService;

@RestController
public class DeptController_consumer {

	@Autowired
	private DeptClientService deptService;
	
	
	@GetMapping("consumer/dept/get/{deptno}")
	public Dept get(@PathVariable("deptno") Long deptno) {
		return deptService.get(deptno);
	}
	
	@GetMapping("consumer/dept/list")
	public List<Dept> list() {
		return deptService.list();
	}
	
	
	@PostMapping("consumer/dept/add")
	public boolean add(Dept dept) {
		return deptService.add(dept);
	}
	
	
}
